package com.briup.day23;

import java.io.FileReader;
import java.io.FileWriter;

public class Test_TryCatch {
        public static void main(String[] args) {
            FileReader fr = null;
            FileWriter fw = null;
            try{
                 fr = new FileReader("01-Basic/src/dir/a.txt");
                  fw = new FileWriter("01-Basic/src/dir/b.txt",true);
                int len;
                char[] buf = new char[8];
                while((len=fr.read(buf))!=-1){
                    fw.write(buf,0,len);
                }
                System.out.println("写入完成");
            }catch(Exception e){
                e.printStackTrace();
            }finally{
                try{
                    fr.close();//他又问题下面就没法关了
                }catch(Exception e){
                    e.printStackTrace();
                }
                try{
                    fw.close();
                }catch(Exception e){
                    e.printStackTrace();
                }
            }
//        文件字符输入流 文件字符输出流对象
        }
    }
